import request from "@/utils/request"
export interface LoginParamsType {
    username: string
    password: string,
}
export interface LoginResultType {
    token: string
}

export interface UserInfoType {
    routes: string[];
    buttons: string[];
    roles: string[];
    name: string;
    avatar: string;
}

// 数据类型
export interface TrademarkDataType {
    id?: number;
    logoUrl: string;
    tmName: string;
}

// 分页类型
export interface TrademarkListParamsType {
    page: number;
    limit: number;
}

// 分页数据类型
export interface TrademarkListReturnType {
    records: TrademarkDataType[];
    total: number;
    size: number;
    current: number;
    searchCount: number;
    pages: number;
}
// 登陆请求
export const reqLogin = (userInfo: LoginParamsType) => {
    return request.post<null, LoginResultType>(`/admin/acl/index/login`, userInfo)
}

// 退出登陆请求
export const reqLayOut = () => {
    return request.post<null, null>(`/admin/acl/index/logout`)
}

// 获取用户信息
export const reqUserInfo = () => {
    return request.get<null, UserInfoType>(`/admin/acl/index/info`)
}


// Trademark获取分页列表数据
export const reqUestList = ({ page, limit }: TrademarkListParamsType) => {
    return request.get<any, TrademarkListReturnType>(
        `/admin/product/baseTrademark/${page}/${limit}`
    );
};

// Trademark新增
export const reqTMAdd = (trademarkParam: TrademarkDataType) => {
    return request.post<any, null>(
        `/admin/product/baseTrademark/save`,trademarkParam
    );
};